import { AirBags, Engine } from './dependencies';

export class Car {
  public brand: string;
  public engine: Engine;
  public airBags: AirBags;
  constructor(brand: string, engine: Engine, airBags: AirBags) {
    this.brand = brand;
    this.engine = engine;
    this.airBags = airBags;
    console.log(
      `construct one ${brand} car with ${engine.displacement} cc engine and ${engine.cylinder} cylinders and ${airBags.count} airbags`
    );
  }
  run() {
    this.engine.start();
    console.log(`${this.brand} car is running`);
  }

  onAccident() {
    this.engine.stop();
    this.airBags.deploy('accident');
  }
}
